const App = {
  mixins: [Query], //配置文件，路径/utils/mixins.js
  data() {
    return {
      options: [],
      treeData: [],
      village: [],
      page: {
        value1: "",
        //value2:'',
        PageNumber: 1, //页码
        RowAmount: 10,
        Condition: "",
        //Condition:"",
      },
      CategroyNameQuery: '',
    };
  },
  mounted() { },
  methods: {
    postgetList() {
      const _this = this;
      let strWhere = ""


      // if (_this.CategroyNameQuery != null && _this.CategroyNameQuery != '') {
      //   strWhere = " category_name like '%" + _this.CategroyNameQuery + "%'";
      // }
      // else {
      //   strWhere = '';
      // }

      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryForObtainingTrees`,
        type: "GET",
        data: {
          TableName: "complaints_categories",
          //Condition: strWhere //暂时不支持加条件?
        },
        success: (data) => {
          console.log(data);
          _this.Tabletdata = data; // 直接使用 this
          _this.loading = false;
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
        dataType: "json",
      });
    },
    complaint_categoriesAdd() {
      window.location.href = "./add.html?action=Add";
    },
    check() {
      //this.page.Condition = window.btoa(unescape(encodeURIComponent(this.page.value1 + ",%"+this.page.value2+"%")));
      this.page.Condition = window.btoa(
        unescape(encodeURIComponent("%" + this.page.value1 + "%"))
      );
      this.postgetList(this.page);
    },
    //树的点击筛选事件
    handleNodeClick(data, node) {
      this.page.Condition = window.btoa(
        unescape(
          encodeURIComponent(
            "%" + this.page.value1 + "%,%" + data.ProvinceNumber + "%"
          )
        )
      );
      this.postgetList(this.page);
    },
    MemberAdd(row) {
      let str = row["Village_Number"];

      let { primary_key } = JSON.parse(
        document.getElementById("table").getAttribute("data-options")
      );
      window.location.href =
        "./memberAdd.html?action=Modify&Village_Number=" +
        str +
        "&nodeKey=" +
        row[primary_key];
    },
    Treedata() {
      const _this = this;
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/clientOperation/getDistrictTree`,
        type: "GET",
        data: {
          DistrictCode: "232723",
        },
        success: (data) => {
          this.treeData = data; // 直接使用 this
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
        dataType: "json",
      });
    },
  },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
